<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="js/jquery.min.js"></script>
    <title>登录</title>
</head>
<body>
    <div>
        <div>
            <span>账号</span>
            <input type="text" id="username">
        </div>
        <div>
            <span>密码</span>
            <input type="password" id="password">
        </div>
        <div>
            <button onclick="login()">登录</button>
        </div>
    </div>
    
    <script>

        //登录
        function login() {
            let username = jQuery("#username");          
            let password = jQuery("#password");
            if(username.val() == "") {
                alert("账号不能为空");
                username.focus();
                return;
            }
            if(password.val() == "") {
                alert("密码不能为空");
                password.focus();
                return;
            }

        }

    </script>

</body>
</html>